package datatime;

import java.util.Calendar;
import java.util.Date;

public class CalendarTest3 {

    public static void main(String[] args) {

        //1、获得一个 Calendar 实例
        final Calendar calendar = Calendar.getInstance();
        System.out.println( calendar );

        //2、清空 Calendar 实例
        calendar.clear();
        System.out.println( calendar );

        //3、根据实际需要设置 年、月、日、时、分、秒、毫秒
        calendar.set(1997,10,25,18,45,20);
        System.out.println( calendar );

        //4、通过Calendar 实例来获得Date对象
        Date date = calendar.getTime();
        System.out.println( date );

        long millis = calendar.getTimeInMillis();//通过 Calendar 实例获得 瞬间 的毫秒值

    }
}
